<template>
  <a-modal
    :visible="visible"
    :title="$t('核对批次详情')"
    @cancel="handleClose"
    :footer="false"
    width="600px"
  >
    <a-descriptions :column="2" size="small" bordered>
      <a-descriptions-item :label="$t('批次号')">
        {{ record?.batchNo }}
      </a-descriptions-item>
      <a-descriptions-item :label="$t('平台ID')">
        {{ record?.platformId }}
      </a-descriptions-item>
      <a-descriptions-item :label="$t('总记录数')">
        {{ record?.totalCount || 0 }}
      </a-descriptions-item>
      <a-descriptions-item :label="$t('成功记录数')" class="success-count">
        {{ record?.successCount || 0 }}
      </a-descriptions-item>
      <a-descriptions-item :label="$t('失败记录数')" class="fail-count">
        {{ record?.failCount || 0 }}
      </a-descriptions-item>
      <a-descriptions-item :label="$t('状态')">
        <a-tag :color="record?.status === 0 ? 'blue' : record?.status === 1 ? 'green' : ''">
          {{ record?.status === 0 ? '处理中' : record?.status === 1 ? '处理完成' : '-' }}
        </a-tag>
      </a-descriptions-item>
      <a-descriptions-item :label="$t('创建时间')">
        {{ record?.createTime }}
      </a-descriptions-item>
      <a-descriptions-item :label="$t('更新时间')">
        {{ record?.updateTime }}
      </a-descriptions-item>
      <a-descriptions-item :label="$t('创建人')">
        {{ record?.createBy || '-' }}
      </a-descriptions-item>
      <a-descriptions-item :label="$t('更新人')">
        {{ record?.updateBy || '-' }}
      </a-descriptions-item>
    </a-descriptions>
  </a-modal>
</template>

<script lang="ts" setup>
import type { OrderVerifyBatch } from '@/api/order/reconciliation/types';

const props = defineProps<{
  visible: boolean;
  record: OrderVerifyBatch | null;
}>();

const emit = defineEmits<{
  (e: 'update:visible', visible: boolean): void;
}>();

// 关闭
function handleClose() {
  emit('update:visible', false);
}
</script>

<style scoped lang="less">
.success-count {
  :deep(.arco-descriptions-item-value) {
    color: #52C41A;
  }
}

.fail-count {
  :deep(.arco-descriptions-item-value) {
    color: #FF4D4F;
  }
}
</style> 